#!/usr/bin/python3
# -*- coding: utf-8 -*-

import yaml


class YamlHandler:
    def __init__(self, file):
        self.file = file
        self.encoding = "utf-8"

    def read_yaml(self):
        with open(self.file, "r", encoding=self.encoding) as f:
            return yaml.load(f.read(), Loader=yaml.FullLoader)

    def write_yaml(self, data):
        with open(self.file, "w", encoding=self.encoding) as f:
            return yaml.dump(data, stream=f, allow_unicode=True)
